﻿Chenxin.UI.PrintInServiceForm = Chenxin.extend(Chenxin.UI.FormCommon, {
    actionUrl: '/service/logic/PrintServiceCharge.ashx',
    id: 'frm_printservicein',
    jqmWidth: 800,
    jqmHeight: 425,
    title: '打印预览',
    type: 'jqmodel',
    defBBtn: false,
    autoHide: true,
    op: 'printview',
    jqmHasFoot: true,
    createBBtn: function() {
        return [{
            text: '页面设置',
            handler: this.settingPring
        }, {
            text: '打印',
            handler: this.printForm
        }, {
            text: '关闭',
            handler: this.hide,
            scope: this
        }]
        },
        fitData: function(model) {
            curModel = model;
            if (model.BusinessType == '10')
                model.BusinessType = '出售';
            else if (model.BusinessType == '20')
                model.BusinessType = '出租';
            model = model || {};
            Chenxin.Fn.BindData(model, this.id);
        },
        settingPring: function() {
            document.all.WebBrowser.ExecWB(8, 1);
        },
        createForm: function() {
            return Chenxin.FormCommon.serviceInForm(this.id);
        },
        saveSucc: function() {
            this.hide;
        },
        printForm: function() {
            var _curForm = this;
            //保存打印信息
            Chenxin.ajax({
                type: "get",
                dataType: "json",
                url: "/service/logic/PrintServiceCharge.ashx",
                data: { op: 'saveprint', billId: curModel.ReceiptId, billCode: curModel.ReceiptCode },
                onSuccess: function(data) {
                    var prtContent = $("#frm_printservicein").find(".x-win-body").html();
                    var WinPrint = window.open('', '', 'letf=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0,menubar=0');
                    WinPrint.document.write(prtContent);
                    WinPrint.document.close();
                    WinPrint.focus();
                    WinPrint.print();
                    WinPrint.close();
                }
            });
        },
        reset: function() {
            this.fitData({});
        },
        initComponent: function() {
            Chenxin.UI.PrintInServiceForm.superclass.initComponent.call(this);
        }
    });

    Chenxin.FormCommon.serviceInForm = function(formId) {// height:100px;overflow:auto;
        return '  <div style="font-family:宋体, Geneva, sans-serif;margin:auto; width:704px;padding-left:15px;"><div style="width:704px;float:left;text-align:center;margin-top:15px;"><span style="color:#000; font-size:22px;font-weight:bolder;text-align:center;">服 务 费 收 据</span></div><div style="width:704px;float:left;text-align:center;margin-top:10px;"><span style="text-align:center;font-size:12px;">打印时间：<span id="' + formId + 'PrintTime"></span></span></div><div style="width:704px;float:left;text-align:right;margin-top:10px;margin-bottom:15px;"><span style="text-align:right;font-size:13px; margin-right:15px;">收据编号：<span id="' + formId + 'ReceiptCode" style=\"text-decoration : underline;\"></span></span></div><div style="width:350px;float:left;height:25px;margin-left:30px;"><span style="font-size:15px;">客户(付款人)姓名:<span id="' + formId + 'CustomerName" style=\"text-decoration : underline;\"></span></span></div><div style="float:left;"><span style="font-size:15px; ">收款门店:<span id="' + formId + 'ReceiptDepart" style=\"text-decoration : underline;\"></span></span></div><div style="width:350px;float:left;height:25px;margin-left:30px;"><span style="font-size:15px;">成交类型:<span id="' + formId + 'BusinessType" style=\"text-decoration : underline;\"></span></span></div><div style="float:left;"><span style="font-size:15px; ">款项性质:<span id="' + formId + 'ReceiptMoneyName" style=\"text-decoration : underline;\"></span></span></div><div style="float:left;width:700px;height:25px;margin-left:30px;"><span style="font-size:15px; ">物业地址:<span id="' + formId + 'HouseAddress" style=\"text-decoration : underline;\"></span></span></div><div style="width:450px;float:left;height:25px;margin-left:30px;"><span style="font-size:15px; ">服务费金额:人民币(大写)<span id="' + formId + 'GetedMoneyBig" style=\"text-decoration : underline;\"></span></span></div><div style="float:left;"><span style="font-size:15px; ">小写:<span id="' + formId + 'GetedMoney" style=\"text-decoration : underline;\"></span>元</span></div><div style="width:704px;float:left;" id="' + formId + 'Details"></div><div style="width:704px;float:left;height:25px;margin-top:15px;margin-left:30px;"><span style="font-size:18px; ">注意事项：</span></div><div style="width:704px;float:left;margin-left:30px;margin-top:5px;"><span style="font-size:12px; ">1、我公司将按实际收款金额出具发票，发票出具后，本收据自动作废。</span></div><div style="width:704px;float:left;margin-left:30px;margin-top:5px;"><span style="font-size:12px; ">2、如您未及时收到发票，请联系您的物业顾问，我们将竭诚为您服务。</span></div><div style="width:704px;float:left; height:30px;"></div><div style="width:350px;float:left;height:25px;margin-top:15px;margin-left:30px;"><span style="font-size:15px; ">客户(付款人)签字:</span><span style=\"text-decoration : underline; width:100px;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></div><div style="float:left;height:25px;margin-top:15px;"><span style="font-size:15px; ">中介方收款人:</span><span style=\"text-decoration : underline; width:100px;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></div><div style="width:350px;float:left;height:25px;margin-left:30px;"><span style="font-size:15px; ">日期:</span><span style=\"text-decoration : underline; width:100px;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></div><div style="float:left;"><span style="font-size:15px; ">收款日期:</span><span style=\"text-decoration : underline; width:100px;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></div><div style="width:700px;float:left;height:25px;margin-left:30px;"><span style="font-size:12px; ">注:此收据是第<span id="' + formId + 'PrintCount"></span>次打印。</span></div></div>';
    }